package ui.adapter;

import android.widget.TextView;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.fy.fyzf.R;
import com.fy.fyzf.base.BaseApp;
import com.fy.fyzf.bean.IntegralRecordBean;

import java.util.List;

public class IntegralRecordAdapter extends BaseQuickAdapter<IntegralRecordBean.ListBean, BaseViewHolder> {

    public IntegralRecordAdapter() {
        super(R.layout.item_exchange_record);
    }

    @Override
    protected void convert(BaseViewHolder helper, IntegralRecordBean.ListBean item) {
        switch (item.getType()) {
            case 0:
                helper.setText(R.id.tv_name, "签到");
                break;
            case 1:
                helper.setText(R.id.tv_name, "添加房源");
                break;
            case 2:
                helper.setText(R.id.tv_name, "添加房源跟进");
                break;
            case 3:
                helper.setText(R.id.tv_name, "添加房源图片");
                break;
            case 4:
                helper.setText(R.id.tv_name, "添加客源");
                break;
            case 5:
                helper.setText(R.id.tv_name, "兑换商品");
                break;
            case 6:
                helper.setText(R.id.tv_name, "分享房源");
                break;
            case 7:
                helper.setText(R.id.tv_name, "发布需求");
                break;
            case 8:
                helper.setText(R.id.tv_name, "匹配房源");
                break;
        }

        helper.setText(R.id.tv_time, item.getCreateTime());
        TextView textView = helper.getView(R.id.tv_status);
        textView.setTextColor(BaseApp.getContext().getResources().getColor(R.color.app_color_f6));
        textView.setText("剩余"+item.getEndIntegration()+"积分");
        if (item.getChangeType() == 0) {
            helper.setText(R.id.tv_integral, "+" + item.getIntegration());
        } else {
            helper.setText(R.id.tv_integral, "-" + item.getIntegration());
        }
    }
}
